
import csv
import sys

fileName = "files/test.csv"

def readFile_readline(filePath):
    with open(filePath) as f:
        stop = False
        while not stop:
            line = f.readline()
            print(line)
            stop = not line

def readFile_itorator(filePath):
    with open(filePath) as f:
        for line in f:
            print(line)

def readCsv(fileName):
    try:
        with open(fileName) as f:
            reader = csv.reader(f)
        header = next(reader)
        data = [row for row in reader]
    except csv.Error as e:
        print("Error reading CSV file at line $s:$s" %(reader.line_num),e)
        sys.exit(-1)

    if header:
        print(header)
        print("==================")
    for datarow in data:
        print(datarow)

def main():
    #readCsv(fileName)
    #readFile_readline(fileName)
    readFile_itorator(fileName)

if __name__ == "__main__":
    main()